package com.situ.myboot.config;

import com.situ.myboot.interceptor.LoginInterceptor;
import com.situ.myboot.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    // <bean></bean>
    @Bean
    public User createUser() {
        return new User();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/*")
                .excludePathPatterns("/login/getLoginPage", "/auth/code", "/login/login", "/error", "/static/**");
    }
}
